package com.ccc.scala.base5_function

object TestTemplateMethod {
  def main(args: Array[String]): Unit = {
    TM.execute {
      println("do execute...")
    }
  }

  object TM {
    def execute(op: => Unit): Unit = {
      startTransaction()
      op
      endsTransaction()
    }

    private def startTransaction(): Unit = {
      println("startTransaction")
    }

    private def endsTransaction(): Unit = {
      println("endsTransaction")
    }
  }

}
